package com.alks.function.controller.finance.costcheck;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.PcSlipDetailPacks;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.dto.finance.costcheck.PcPackDetailsReq;
import com.alks.function.service.impl.stockdept.pcfactorystockquery.PackMtlIOServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@ApiRestController("/mtlPackCheck")
@Api(tags = "包材收货检核")
public class PcSlipDetailPackController {
    @Autowired
    PackMtlIOServiceImpl packMtlIOService;
    @PostMapping("/getSlipDetailPack")
    @WebLogger
    @ApiOperation("材料入库单号查询")
    public ResponseInfo getSlipDetailPack(@RequestBody PcPackDetailsReq req){
        return packMtlIOService.getSlipDetailPack(req);
    }

    @PostMapping("/optionPackCheck")
    @WebLogger
    @ApiOperation("打勾检核、取消检核")
    public ResponseInfo optionPackCheck(@RequestBody List<String> list, @RequestParam @ApiParam(value = "1: 打勾检核 2：打勾取消检核") String check){
        return packMtlIOService.optionPackCheck(list,check);
    }

    @PostMapping("/setRemarkPack")
    @WebLogger
    @ApiOperation("备注确认")
    public ResponseInfo setRemarkPack(@RequestBody List<String> slipNos,@RequestParam String remark){
        return packMtlIOService.setRemarkPack(slipNos,remark);
    }

    //TODO 包材取单价
    @PostMapping("/setUnitPrice")
    @WebLogger
    @ApiOperation("取单价")
    public ResponseInfo setUnitPrice(@RequestBody List<PcSlipDetailPacks> list){
        return packMtlIOService.setUnitPrice(list);
    }

    @PostMapping("/getPcSlipPackDetail")
    @WebLogger
    @ApiOperation("入库明细查询")
    public ResponseInfo getPcSlipPackDetail(@RequestParam String slipNo){
        return packMtlIOService.getPcSlipPackDetail(slipNo);
    }
    //入库明细查询

    @PostMapping("/savePcSlipPackDetail")
    @WebLogger
    @ApiOperation(value = "保存")
    public ResponseInfo savePcSlipPackDetail(@RequestBody List<PcSlipDetailPacks> list){
        return packMtlIOService.savePcSlipPackDetail(list);
    }


}
